package com.superlc.ssm.modular.sys.controller;

import com.superlc.ssm.modular.sys.model.SysRole;
import com.superlc.ssm.modular.sys.service.SysRoleService;
import com.superlc.ssm.common.util.ResponseEntity;
import com.superlc.ssm.common.util.ResponseUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @ProjectName: ssm$
 * @Package: com.superlc.ssm.modular.sys.controller$
 * @ClassName: RoleController$
 * @Description: 角色信息的修改
 * @Author: super
 * @CreateDate: 2018/8/15$ 13:10$
 * @UpdateUser: 更新者
 * @UpdateDate: 2018/8/15$ 13:10$
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
@Controller
public class RoleController {

    @Resource
    private SysRoleService sysRoleService;

    @ResponseBody
    @RequestMapping("/addRole")
    public ResponseEntity addRole(SysRole sysRole){
        sysRoleService.insert(sysRole);
        return ResponseUtils.success(sysRole);
    }

    @ResponseBody
    @RequestMapping("/addPermissionToRole")
    public ResponseEntity addPermissionRole(@RequestParam("permissionId")Integer permissionId,@RequestParam("roleId")Integer roleId){
       return ResponseUtils.success(sysRoleService.addPermissionToRoleById(permissionId,roleId));
    }


}
